package com.spring.custom_factory;

import org.springframework.beans.factory.InitializingBean;

import java.util.ArrayList;
import java.util.List;

public class MyFactory implements InitializingBean{

	private static List<MyServiceImpl>  context = new ArrayList<>();
	private static MyServiceImpl myService = new MyServiceImpl();
	public MyServiceImpl getMyServiceImpl(){
		//MyServiceImpl myService = new MyServiceImpl();
		return myService;
	}

	public static List<MyServiceImpl> getContext(){
		return context;
	}


	@Override
	public void afterPropertiesSet() throws Exception {
		context.add(myService);
	}
}
